package cn.turboinfo.dongying.api.entity.common.enumeration.shop;

import lombok.extern.slf4j.Slf4j;
import net.sunshow.toolkit.core.base.enums.BaseEnum;
import net.sunshow.toolkit.core.base.enums.BaseEnumHelper;

import java.util.List;

/**
 * 门店排序方式
 */
@Slf4j
public enum ShopSortType implements BaseEnum {

    ALL(-1, "全部"),

    DEFAULT(0, "不限排序"),

    CREDIT_SCORE_DESC(10, "按信用分从高到低"),
    CREDIT_SCORE_ASC(15, "按信用分从低到高"),

    DISTANCE_DESC(20, "距离从远到近"),
    DISTANCE_ASC(25, "距离从近到远"),
    ;

    private int value;
    private String name;

    ShopSortType(int value, String name) {
        this.value = value;
        this.name = name;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return name;
    }

    public static ShopSortType get(int value) {
        return BaseEnumHelper.getByValue(value, values());
    }

    public static List<ShopSortType> list() {
        return BaseEnumHelper.getList(values());
    }

    public static List<ShopSortType> listAll() {
        return BaseEnumHelper.getAllList(values());
    }
}
